<!-- 流程提交公共页面 -->
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<div style="margin-bottom:20px">
	<input class="easyui-textbox easyui-validatebox" name="comment" id="comment" multiline="true" style="width:780px;height:40px;"
	 data-options="label:'批注:',required:true,validType:'length[0,150]'" />
</div>

<div style="margin-bottom:20px">
	<label class="textbox-label textbox-label-before"  style="text-align: left; height: 40px;">处理:</label>
	<span class="textbox" style="border: 0;">
		<div id="processBut"  style="padding: 3px;"></div>
		<input name="outcome" type="hidden">
	</span>
</div>


<div style="margin-bottom:20px">
	<label class="textbox-label textbox-label-before"  style="text-align: left; height: 40px;">批注列表:</label>
	<span class="textbox" style="width: 675px;">
		<table id="commentGrid" title="批注信息列表" style="height:150px;"></table> 
	</span>
</div>

<script>
$(function(){
	var outComeList = '${outComeList}' || '[]';
	outComeList = JSON.parse(outComeList);
	var buttons = [];
	$.each(outComeList, function (j,buttonName) {
		if(buttonName=='默认提交' || buttonName=='提交' ){
			buttons.push('&nbsp;&nbsp;<input type="button" style="width:100px;height:30px;border:3px orange double;background-color:#E0ECFF" value="'+ buttonName +'" />');
		}else if(buttonName=='驳回' ){
			buttons.push('&nbsp;&nbsp;<input type="button" value="驳回" style="width:100px;height:30px;"  />');
		}else{
			buttons.push('&nbsp;&nbsp;<input type="button" style="width:100px;height:30px;border:3px orange double;background-color:#E0ECFF" value="'+ buttonName +'" />');
		}
	});
	$("#processBut").html(buttons);
	
	$("#processBut input[type=button]").on("click",function(){
		var value = $(this).val();
		$.messager.confirm('确认','您确认【'+ value +'】处理吗？',function(r){    
		    if (r){
		    	$("input[name=outcome]").val(value);
		    	document.getElementById('easyuiForm').submit();
		        return true;
		    }    
		});  
		return false;
	});
	
	/*批注数据加载*/
	$('#commentGrid').datagrid({    
	    url:'/console/activiti/task/commentList?taskId=${taskId}',    
	    columns:[[    
	        {field:'time',title:'时间',width:130},    
	        {field:'userId',title:'批注人',width:130},    
	        {field:'fullMessage',title:'批注信息',width:'50%'}    
	    ]]    
	});  

});
</script>